﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:MDCAdminTool.Commands"
    xmlns:ms="clr-namespace:System.Collections;assembly=mscorlib" 
    xmlns:MDCAdminTool="clr-namespace:MDCAdminTool;assembly=E4D.AppFabric.Entities" >
    
   <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="Images.xaml" />
   </ResourceDictionary.MergedDictionaries>

    
    <HierarchicalDataTemplate DataType="{x:Type MDCAdminTool:CacheCluster}" ItemsSource="{Binding Groups}">
      <StackPanel Orientation="Horizontal">
         <Image Source="{Binding Path=IconPath}" Height="22" Width="22" Margin="0,0,3,0"/>
         <TextBlock>
            Cluster: <TextBlock Text="{Binding Name}" FontWeight="Bold"/>
            <TextBlock.ContextMenu>
                    <ContextMenu ItemsSource="{StaticResource clusterMenuItems}"/>
            </TextBlock.ContextMenu>
         </TextBlock>
      </StackPanel>
    </HierarchicalDataTemplate>
    

   <HierarchicalDataTemplate DataType="{x:Type MDCAdminTool:CacheHost}" >

        <StackPanel Orientation="Horizontal">
            <Image Name="img" Source="..\Resources\Folder_Closed.png" Height="16" Width="16" />
            <TextBlock Text="Hosts" Margin="5,0,0,0" VerticalAlignment="Center"/>
        </StackPanel>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeViewItem}}, Path=IsExpanded }"
                                           Value="True">
                <Setter TargetName="img" Property="Source" Value="..\Resources\Folder_Open.png" />
            </DataTrigger>
        </DataTemplate.Triggers>
   </HierarchicalDataTemplate>

   <DataTemplate x:Key="CacheClusterContentTemplate" DataType="{x:Type MDCAdminTool:CacheCluster}">
      <GroupBox Padding="15">
         <ScrollViewer>
            <Grid>
               <Grid.RowDefinitions>
                  <RowDefinition Height="30*" />
                  <RowDefinition Height="200*" />
                  <RowDefinition Height="30*" />
               </Grid.RowDefinitions>

               <StackPanel x:Name="spTitle" Grid.Row="0" Orientation="Horizontal" Margin="15,0,0,0">
                  <StaticResource ResourceKey="ClusterImage"/>
                  <TextBlock Text="{Binding Name}" FontSize="32" FontWeight="Bold" Margin="15,0,0,0" />
                  <TextBlock x:Name="HeaderText" Text=" Cache Cluster" FontSize="32" FontWeight="Bold" />
               </StackPanel>

               <StackPanel x:Name="spBody" Margin="15" Orientation="Vertical" Grid.Row="1">

                  <GroupBox Padding="15" Margin="0,0,0,25">
                     <GroupBox.Header>
                        <StackPanel Orientation="Horizontal">
                           <StaticResource ResourceKey="GetHostConfig16" />
                           <TextBlock Text="Cache Cluster Config File" Margin="5,0,0,0"/>
                        </StackPanel>
                     </GroupBox.Header>
                     <Grid x:Name="gridCacheClusterConfigFile">

                        <Grid.ColumnDefinitions>
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                           <!--<RowDefinition Height="Auto" />-->
                        </Grid.RowDefinitions>

                        <!--<Label Content="Config File:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <DockPanel Grid.Column="1" Grid.Row="0" LastChildFill="True">
                           <Button   DockPanel.Dock="Right" Height="23" Width="75" Margin="0,0,5,0" Content="Load" Command="{StaticResource LoadConfigCacheCluster}" CommandParameter="{Binding}"/>
                           <Button   DockPanel.Dock="Right" Height="23" Width="16" Margin="0,0,5,0" Content="..." Command="{StaticResource OpenFileDialog }" CommandTarget="{Binding ElementName=LoadconfigFileTextBox}"/>
                           <TextBox  Height="23" HorizontalAlignment="Stretch" Margin="3" x:Name="LoadconfigFileTextBox" Text="{Binding ConfigFile}" VerticalAlignment="Center" >
                              <TextBox.CommandBindings>
                                 <src:OpenFileDialog/>
                              </TextBox.CommandBindings>
                           </TextBox>
                        </DockPanel>-->

                        <Label Content="Import Config File:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" ToolTip="{StaticResource Help-Desc-ImportCacheCluster}"/>
                        <DockPanel Grid.Column="1" Grid.Row="0" LastChildFill="True">
                           <Button   DockPanel.Dock="Right" Height="23" Width="75" Margin="0,0,5,0" Content="Import" Command="{StaticResource ImportConfigCacheCluster}" CommandParameter="{Binding}" ToolTip="{StaticResource Help-Desc-ImportCacheCluster}"/>
                           <!--<Button   DockPanel.Dock="Right" Height="23" Width="16" Margin="0,0,5,0" Content="..." Command="{StaticResource OpenFileDialog }" CommandTarget="{Binding ElementName=configFileTextBox}"/>-->
                           <TextBox  Height="23" MinWidth="150" HorizontalAlignment="Stretch" Margin="3" x:Name="configFileTextBox" Text="{Binding ImportConfigFile}" VerticalAlignment="Center">
                              <TextBox.CommandBindings>
                                 <src:OpenFileDialog/>
                              </TextBox.CommandBindings>
                           </TextBox>
                        </DockPanel>

                        <Label Content="Export Config File:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" ToolTip="{StaticResource Help-Desc-ExportCacheCluster}"/>
                        <DockPanel Grid.Column="1" Grid.Row="1" LastChildFill="True">
                                    <Button DockPanel.Dock="Right" Height="23" Width="75" Margin="0,0,5,0" Content="Export" Command="{StaticResource ExportConfigCacheCluster}" CommandParameter="{Binding}" ToolTip="{StaticResource Help-Desc-ExportCacheCluster}"/>

                           <!--<Button   DockPanel.Dock="Right" Height="23" Width="16" Margin="0,0,5,0" Content="..."    Command="{StaticResource OpenFileDialog }" CommandTarget="{Binding ElementName=exportConfigFileTextBox}"/>-->
                           <TextBox  Height="23" MinWidth="150" HorizontalAlignment="Stretch" Margin="3" x:Name="exportConfigFileTextBox" Text="{Binding ExportConfigFile}" VerticalAlignment="Center" >
                              <TextBox.CommandBindings>
                                 <src:OpenFileDialog/>
                              </TextBox.CommandBindings>
                           </TextBox>
                        </DockPanel>

                     </Grid>
                  </GroupBox>

                  <!--<GroupBox Padding="15" >
                     <GroupBox.Header>
                        <StackPanel Orientation="Horizontal">
                           <StaticResource ResourceKey="GetHostConfig16" />
                           <TextBlock Text="Cache Cluster Config Info" Margin="5,0,0,0"/>
                        </StackPanel>
                     </GroupBox.Header>
                     <Grid x:Name="gridCacheCluster">

                        <Grid.ColumnDefinitions>
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Label Content="Connection String:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0">
                           <TextBox Height="23" HorizontalAlignment="Stretch" Margin="3" x:Name="connectionStringTextBox" Text="{Binding ConnectionString}" VerticalAlignment="Center" />
                           <Button Height="23" Width="16" Margin="0,0,5,0" Content="..."/>
                        </StackPanel>

                        <Label Content="Name:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" x:Name="nameTextBox" Text="{Binding Name}" VerticalAlignment="Center" Width="150" />

                        <Label Content="Provider:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" x:Name="providerTextBox" Text="{Binding Provider}" VerticalAlignment="Center" Width="150" />

                        <Label Content="Status:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="3" x:Name="statusTextBox" Text="{Binding Status}" VerticalAlignment="Center" Width="150" />

                     </Grid>

                  </GroupBox>-->

               </StackPanel>

               <StackPanel x:Name="spFooter" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,15,0">
                        <Button Height="23" Width="75" Margin="5,0,5,0" Content="Cancel" Command="{StaticResource TabClose}" />
                  <Button Height="23" Width="75" Margin="5,0,5,0" Content="Save"   Command="{StaticResource SaveConfigCacheCluster}" CommandParameter="{Binding}"/>
               </StackPanel>

            </Grid>
         </ScrollViewer>
      </GroupBox>
   </DataTemplate>
   
   <DataTemplate x:Key="XMLContentTemplate">
      <GroupBox Padding="15">
         <ScrollViewer>
            <Grid>

               <Grid.RowDefinitions>
                  <RowDefinition Height="30*" />
                  <RowDefinition Height="230*" />
               </Grid.RowDefinitions>

               <StackPanel x:Name="spTitle" Grid.Row="0" Orientation="Horizontal" Margin="15,0,0,0">
                  <StaticResource ResourceKey="ClusterImage"/>
                  <TextBlock Text="{Binding Name}" FontSize="32" FontWeight="Bold" Margin="15,0,0,0" />
                  <TextBlock x:Name="HeaderText" Text=" Config File" FontSize="32" FontWeight="Bold" />
               </StackPanel>
              
               <GroupBox Padding="15" x:Name="spBody" Margin="15"  Grid.Row="1">
                  <GroupBox.Header>
                     <StackPanel Orientation="Horizontal">
                        <StaticResource ResourceKey="GetHostConfig16" />
                        <TextBlock Text="Cache Cluster Config File" Margin="5,0,0,0"/>
                     </StackPanel>
                  </GroupBox.Header>
                  
               </GroupBox>
            </Grid>
         </ScrollViewer>
      </GroupBox>
   </DataTemplate>
   
</ResourceDictionary>